/**
 * Created with JetBrains PhpStorm.
 * User: sztpzhouhm
 * Date: 14-5-15
 * Time: 下午5:29
 * To change this template use File | Settings | File Templates.
 */
/*
document.write('<link href="../style/citySelect.css" rel="stylesheet" media="screen">');
document.write("<script language='javascript' src='../js/cityData.js'></script>");
$(document).ready(function(){
    var airPortInfo = {};
    var cityCtrl = '';
    var cityMatch = '';
    var hotCitykEY = ['PEK' ,'NAY' ,'SHA' ,'PVG', 'CTU' ,'SZX' ,'CAN' ,'CKG' ,
        'CSX' ,'XIY' ,'WUH' ,'SYX' ,'TAO' ,'NKG' ,'KMG' ,'XMN'];
    var hotCitys = [];
    var inputName = '';
    var _this = null;

    function setCtrlHead(Position,obj){
        cityCtrl = '<div id="cityselect" class="CityDiv more_city_wrap_zhm" style="top:'+(Position.y+obj.clientHeight+4)+'px;left:'+(Position.x)+'px;"><div id="cityHead"><ul id="headIndex" class="more_city_top_zhm">';
        cityCtrl += '<li><a id="hot" class="city_select selected">热门城市</a></li>'
            + '<li><a id="ABCD" class="city_select">ABCD</a></li>'
            + '<li><a id="EFGHJ" class="city_select">EFGHJ</a></li>'
            + '<li><a id="KLMN" class="city_select">KLMN</a></li>'
            + '<li><a id="PQRSTW" class="city_select">PQRSTW</a></li>'
            + '<li><a id="XYZ" class="city_select">XYZ</a></li></ul><div id="cities" class="more_city_center"><ul class="citylist_ul"></ul></div></div></div>'
    }

    function showIndex(key){
        var cityStr = '';
        if(key == 'hot'){
            for(var k = 0 ; k < hotCitykEY.length ; k++){
                for(var i in airPortInfo){
                    if(!isNaN(i)){
                        if(hotCitykEY[k] == airPortInfo[i]['AirportCode']){
                            hotCitys[i] = airPortInfo[i];
                            cityStr += '<li class="chooseCity" data-code="'+airPortInfo[i]["AirportCode"]+'" data-name="'+airPortInfo[i]["AirCityName"]+'"><a>'+airPortInfo[i]['AirCityName']+'</a></li>';
                            break;
                        }
                    }
                }
            }
        }else{
            for(var i = 0 ; i < key.length ; i++){
                for(var j in airPortInfo){
                    if(!isNaN(j)){
                        if(key[i] == airPortInfo[j]['AirCityNamePY'].substr(0,1).toUpperCase()){
                            cityStr += '<li class="chooseCity" data-code="'+airPortInfo[j]["AirportCode"]+'" data-name="'+airPortInfo[j]["AirCityName"]+'"><a>'+airPortInfo[j]['AirCityName']+'</a></li>';
                        }
                    }
                }
            }
        }
        $('#cities ul').html(cityStr);
    }

    function selectCity(key , name){
        $('#'+inputName).remove();
        _this.data('code' , key).val(name)
            .after('<input id="'+inputName+'" name="'+inputName+'" value="'+key+'" type="hidden" />');
        $('#cityselect').hide();
        $('#cityMatched').remove();
    }

    function getPosition(ATarget){
        var target = ATarget;
        var pos = {x:target.offsetLeft, y:target.offsetTop};
        target = target.offsetParent;
        while (target)
        {
            pos.x += target.offsetLeft;
            pos.y += target.offsetTop;

            target = target.offsetParent
        }
        return pos;
    }

    function setMatchOut(Position,obj,str){
        cityMatch = '<div id="cityMatched" class="CityDiv more_city_wrap_zhm" style="top:'+(Position.y+obj.clientHeight+4)+'px;left:'+(Position.x)+'px;">';
        cityMatch += str+'</div>';

    }

    function changePosition(newPosition , obj){
        $('#cityselect').css({'top':newPosition.y+obj.clientHeight+4+'px' ,'left':newPosition.x+'px'});
    }

    function IsArrayOrObject(arr){
        if(Object.prototype.toString.apply(arr) == "[object Array]" || Object.prototype.toString.apply(arr) == "[object Object]"){
            return true;
        }else{
            return false;
        }
    }

    function getKey(searchStr , arr){
        var resuleKey = false;
        var keyStr = '';
        if(IsArrayOrObject(arr)){
            for(var key in arr){
                keyStr += key+'|';
                if(IsArrayOrObject(arr[key])){
                    resuleKey = getKey(searchStr , arr[key]);
                    if(resuleKey){
                        keyStr += resuleKey;
                        //break;
                    }else{
                        keyStr = '';
                    }
                }else{
                    if(arr[key] && arr[key].toString().toUpperCase().indexOf(searchStr.toUpperCase()) >= 0 ){
                        resuleKey = key;
                        keyStr = keyStr.substr(0 , (keyStr.length-1))+'_';
                        break;
                    }else{
                        resuleKey = false;
                        keyStr = '';
                    }
                }
            }
        }
        if(!keyStr){
            return false;
        }else{
            return keyStr;
        }
    }

    function ctrlInit(){
        $('.zhmCity').each(function(){
            var tmpName = $(this).attr('name');
            var tmpId = tmpName.replace('InputZhm' , '');
            if($('#'+tmpId).length <= 0){
                $(this).attr('name' , tmpName+'InputZhm').after('<input id="'+tmpId+'" name="'+tmpId+'" value="" type="hidden" />');
            }
        })
    }

    $('.zhmCity').click(function(){
        _this = null;
        _this = $(this);
        var name = $(this).attr('name');
        inputName = name.replace('InputZhm' , '');
        $(this).attr('name' , inputName+'InputZhm');
        $('#cityMatched').remove();
        if($('#cityselect').length > 0){
            var Position = getPosition(this);
            changePosition(Position , this);
            $('#cityselect').show();
        }else{
            airPortInfo = CityData;
            var Position = getPosition(this);
            setCtrlHead(Position, this);
            $('#cityselect').remove();
            $('body').append(cityCtrl);
            showIndex('hot');
            $('body').on('click' ,'.city_select' , function(){
                showIndex($(this).attr('id'));
                $(".selected").removeClass("selected");
                $(this).addClass("selected");
            });
            $('body').on('click' ,'.chooseCity' , function(){
                selectCity($(this).data('code') ,$(this).data('name'));
            });
        }
    });

    $('.zhmCity').on('keyup' ,function(){
        var match = $(this).val().toUpperCase();
        var str = '';
        var matchStr = '';    //匹配到的原机场信息
        var aroundStr = '';   //匹配到的临近机场信息
        var matchNum = 0;
        if(match != ''){
            for(var key in CityData){
                var result = getKey(match , CityData[key]);
                if(result){  //判断是属于城市本身还是要给临近机场
                    if(result.toString().indexOf('AroundCity') >= 0){ //临近机场
                        var citys = CityData[key]['AroundCity'].split('_');
                        var len = citys.length;
                        var city = '';
                        for(var i = 0 ; i < len ; i++){
                            if(citys[i].toString().toUpperCase().indexOf(match) >= 0){
                                city = citys[i];
                                break;
                            }
                        }
                        aroundStr += '<li class="chooseCity inputcity" data-code="'+airPortInfo[key]["AirportCode"]+'" data-name="'+airPortInfo[key]["AirCityName"]+'">'+city+':临近机场'+CityData[key]['AirCityName']+'-'+CityData[key]['AirFullName']+'</li>';
                    }else{
                        matchStr += '<li class="chooseCity inputcity" data-code="'+airPortInfo[key]["AirportCode"]+'" data-name="'+airPortInfo[key]["AirCityName"]+'">'+CityData[key]['AirCityName']+'-'+CityData[key]['AirFullName']+'</li>';
                    }
                    matchNum++;
                    if(matchNum == 10){
                        break;
                    }
                }
            }
            if(!matchStr && !aroundStr){  //没有符合的城市机场
                str = '<ul><li>没有找到对应的机场信息</li></ul>';
            }else{
                str = '<ul class="inputcity_ul">'+matchStr+aroundStr+'</ul>';
            }
            var Position = getPosition(this);
            setMatchOut(Position, this , str);
            $('#cityselect').hide();
            $('#cityMatched').remove();
            $('body').append(cityMatch);
        }else{
            $('#cityselect').show();
            $('#cityMatched').remove();
        }
    });

    document.onmousedown = function(event){
        if($('#cityselect').length > 0 || $('#cityMatched').length > 0){
            event = window.event || event;
            var mouseValeue = event.button;
            var obj1 = document.getElementById('cityselect');
            var obj2 = document.getElementById('cityselect');
            var clientX = event.clientX;
            var clientY = event.clientY;
            var citylX1 = obj1.offsetLeft;
            var citylY1 = obj1.offsetTop;
            var cityrX1 = obj1.offsetLeft+obj1.clientWidth;
            var cityrY1 = obj1.offsetTop+obj1.clientHeight;
            var citylX2 = obj2.offsetLeft;
            var citylY2 = obj2.offsetTop;
            var cityrX2 = obj2.offsetLeft+obj2.clientWidth;
            var cityrY2 = obj2.offsetTop+obj2.clientHeight;
            if(document.all){   //IE
                if(mouseValeue != 0){
                    if(clientX < citylX1 || clientX > cityrX1 || clientY < citylY1 || clientY > cityrY1){
                        $('#cityselect').hide();
                    }
                    if(clientX < citylX2 || clientX > cityrX2 || clientY < citylY2 || clientY > cityrY2){
                        $('#cityMatched').hide();
                    }
                }
            }else{
                if(mouseValeue == 0 || mouseValeue == 1 || mouseValeue == 2){
                    if(clientX < citylX1 || clientX > cityrX1 || clientY < citylY1 || clientY > cityrY1){
                        $('#cityselect').hide();
                    }
                    if(clientX < citylX2 || clientX > cityrX2 || clientY < citylY2 || clientY > cityrY2){
                        $('#cityMatched').hide();
                    }
                }
            }
        }
    };

    ctrlInit();
});*/
var cityCtrlZhm = $.extend(cityCtrlZhm, {
    airPortInfo: {},
    cityCtrl: '',
    hotCitykEY: ['PEK' , 'NAY' , 'SHA' ],
    hotCitys: [],
    inputName: '',
    _this: null,
    skin: 'blue',
    matchedNum: 0,//输入值时匹配的个数
    matchedKey: '',  //当输入值仅匹配到一个数据时，记录匹配记录在源数据的key值

    setCtrlHead: function (Position, obj) {  //设置城市索引选项卡
        cityCtrlZhm.cityCtrl = '<div id="cityselect" class="CityDiv more_city_wrap_' + cityCtrlZhm.skin + '_zhm" style="top:' + (Position.y + obj.clientHeight + 4) + 'px;left:' + (Position.x) + 'px;"><div id="cityHead"><ul id="headIndex" class="more_city_top_' + cityCtrlZhm.skin + '_zhm">';
        cityCtrlZhm.cityCtrl += '<li><a id="hot" class="city_select ' + cityCtrlZhm.skin + '_selected">热门城市</a></li>'
            + '<li><a id="ABCD" class="city_select">ABCD</a></li>'
            + '<li><a id="EFGHJ" class="city_select">EFGHJ</a></li>'
            + '<li><a id="KLMN" class="city_select">KLMN</a></li>'
            + '<li><a id="PQRSTW" class="city_select">PQRSTW</a></li>'
            + '<li><a id="XYZ" class="city_select">XYZ</a></li></ul><div id="cities" class="more_city_center"><ul class="citylist_ul"></ul></div></div></div>'
    },
    showIndex: function (key) {         //设置城市选项卡
        var cityStr = '';
        if (key == 'hot') {
            for (var k = 0; k < cityCtrlZhm.hotCitykEY.length; k++) {
                for (var i in cityCtrlZhm.airPortInfo) {
                    if (!isNaN(i)) {
                        if (cityCtrlZhm.hotCitykEY[k] == cityCtrlZhm.airPortInfo[i]['AirportCode']) {
                            cityCtrlZhm.hotCitys[i] = cityCtrlZhm.airPortInfo[i];
                            cityStr += '<li class="chooseCity" data-code="' + cityCtrlZhm.airPortInfo[i]["AirportCode"] + '" data-name="' + cityCtrlZhm.airPortInfo[i]["AirFullName"] + '"><a>' + cityCtrlZhm.airPortInfo[i]['AirFullName'] + '</a></li>';
                            break;
                        }
                    }
                }
            }
        } 
		/*else {
            for (var i = 0; i < key.length; i++) {
                for (var j in cityCtrlZhm.airPortInfo) {
                    if (!isNaN(j)) {
                        if (key[i] == cityCtrlZhm.airPortInfo[j]['AirCityNamePY'].substr(0, 1).toUpperCase()) {
                            cityStr += '<li class="chooseCity" data-code="' + cityCtrlZhm.airPortInfo[j]["AirportCode"] + '" data-name="' + cityCtrlZhm.airPortInfo[j]["AirCityName"] + '"><a>' + cityCtrlZhm.airPortInfo[j]['AirCityName'] + '</a></li>';
                        }
                    }
                }
            }
        }*/
        $('#cities ul').html(cityStr);
    },
    selectCity: function (key, name) {     //选中城市
        $('#' + cityCtrlZhm.inputName).remove();
        cityCtrlZhm._this.data('code', key).val(name)
            .after('<input id="' + cityCtrlZhm.inputName + '" name="' + cityCtrlZhm.inputName + '" value="' + key + '" type="hidden" />');
        $('#cityselect').hide();
        $('#cityMatched').hide();
    },
    getPosition: function (ATarget) {    //获取元素位置
        var target = ATarget;
        var pos = {x: target.offsetLeft, y: target.offsetTop};
        target = target.offsetParent;
        while (target) {
            pos.x += target.offsetLeft;
            pos.y += target.offsetTop;

            target = target.offsetParent
        }
        return pos;
    },
    setMatchOut: function (Position, obj, str) {     //显示匹配列表
        if ($('#cityMatched').length > 0) {
            $('#cityMatched').html(str).css({'top': (Position.y + obj.clientHeight + 4) + 'px', 'left': (Position.x) + 'px'}).show();
        } else {
            var str2 = '';
            str2 += '<div id="cityMatched" class="CityDiv more_city_wrap_' + cityCtrlZhm.skin + '_zhm" style="top:' + (Position.y + obj.clientHeight + 4) + 'px;left:' + (Position.x) + 'px;">';
            str2 += str + '</div>';
            $('body').append(str2);
        }
    },
    changePosition: function (newPosition, obj) {    //改变位置
        $('#cityselect').css({'top': (newPosition.y+obj.clientHeight+4)+'px', 'left': newPosition.x + 'px'});
    },
    IsArrayOrObject: function (arr) {   //判断原数据是否是对象或者数组
        if (Object.prototype.toString.apply(arr) == "[object Array]" || Object.prototype.toString.apply(arr) == "[object Object]") {
            return true;
        } else {
            return false;
        }
    },
    getKey: function (searchStr, arr) {    //通过字符串搜索该字符串在数组中的下标
        var resuleKey = false;
        var keyStr = '';
        if (cityCtrlZhm.IsArrayOrObject(arr)) {
            for (var key in arr) {
                keyStr += key + '|';
                if (cityCtrlZhm.IsArrayOrObject(arr[key])) {
                    resuleKey = cityCtrlZhm.getKey(searchStr, arr[key]);
                    if (resuleKey) {
                        keyStr += resuleKey;
                        //break;
                    } else {
                        keyStr = '';
                    }
                } else {
                    if (arr[key] && arr[key].toString().toUpperCase().indexOf(searchStr.toUpperCase()) >= 0) {
                        resuleKey = key;
                        keyStr = keyStr.substr(0, (keyStr.length - 1)) + '_';
                        break;
                    } else {
                        resuleKey = false;
                        keyStr = '';
                    }
                }
            }
        }
        if (!keyStr) {
            return false;
        } else {
            return keyStr;
        }
    },
    getNameFromCode: function (code) {    //通过三字码获取名字
        var name = '';
        for (var i in cityCtrlZhm.airPortInfo) {
            if (code.toUpperCase() == cityCtrlZhm.airPortInfo[i]['AirportCode'].toUpperCase()) {
                name = cityCtrlZhm.airPortInfo[i]['AirFullName'];
                break;
            }
        }
        return name;
    },
    getCodeFromName: function (name) {  //通过名字获取三字码
        var code = '';
        for (var i in cityCtrlZhm.airPortInfo) {
            if (cityCtrlZhm.airPortInfo[i]['AirCityName'].indexOf(name) >= 0) {
                code = cityCtrlZhm.airPortInfo[i]['AirportCode'];
                break;
            }
        }
        return code;
    },
    cityClick: function (obj) {     //点击输入框事件
        cityCtrlZhm._this = null;
        cityCtrlZhm._this = $(obj);
        var name = $(obj).attr('name');
        cityCtrlZhm.inputName = name.replace('InputZhm', '');
        $(obj).attr('name', cityCtrlZhm.inputName + 'InputZhm');
        $('#cityMatched').hide();
        if ($('#cityselect').length > 0) {
            var Position = cityCtrlZhm.getPosition(obj);
            cityCtrlZhm.changePosition(Position, obj);
            $('#cityselect').show();
        } else {
            if (!cityCtrlZhm.airPortInfo.length) {
                cityCtrlZhm.airPortInfo = CityData;
            }
            var Position = cityCtrlZhm.getPosition(obj);
            cityCtrlZhm.setCtrlHead(Position, obj);
            $('#cityselect').remove();
            //$('body').append(cityCtrlZhm.cityCtrl);
            //cityCtrlZhm.showIndex('hot');
            $('body').on('click', '.city_select', function () {
                cityCtrlZhm.showIndex($(this).attr('id'));
                $("." + cityCtrlZhm.skin + "_selected").removeClass(cityCtrlZhm.skin + "_selected");
                $(this).addClass(cityCtrlZhm.skin + "_selected");
            });
        }
    },
    cityKeyup: function (obj) {  //写入输入框事件
        var match = $(obj).val().toUpperCase();
        var str = '';
        var matchStr = '';    //匹配到的原机场信息
        var aroundStr = '';   //匹配到的临近机场信息
        var matchNum = 0;
        var matchedKey = '';
        if (match != '') {
            for (var key in CityData) {
                var result = cityCtrlZhm.getKey(match, CityData[key]);
                if (result) {  //判断是属于城市本身还是要给临近机场
                    if (result.toString().indexOf('AroundCity') >= 0) { //临近机场
                        var citys = CityData[key]['AroundCity'].split('_');
                        var len = citys.length;
                        var city = '';
                        for (var i = 0; i < len; i++) {
                            if (citys[i].toString().toUpperCase().indexOf(match) >= 0) {
                                city = citys[i];
                                break;
                            }
                        }
                        aroundStr += '<li class="chooseCity inputcity" data-code="' + cityCtrlZhm.airPortInfo[key]["AirportCode"] + '" data-name="' + cityCtrlZhm.airPortInfo[key]["AirFullName"] + '">' + city + ':临近机场' + CityData[key]['AirFullName'] + '-' + CityData[key]['AirportCode'] + '</li>';
                    } else {
                        matchStr += '<li class="chooseCity inputcity" data-code="' + cityCtrlZhm.airPortInfo[key]["AirportCode"] + '" data-name="' + cityCtrlZhm.airPortInfo[key]["AirFullName"] + '">' + CityData[key]['AirFullName'] + '-' + CityData[key]['AirportCode'] + '</li>';
                    }
                    matchNum++;
                    if (matchNum == 10) {
                        break;
                    }
                    matchedKey = key;
                }
            }
            if (!matchStr && !aroundStr) {  //没有符合的城市机场
                str = '<ul class="inputcity_ul"><li class="inputcity">没有找到对应的机场信息</li></ul>';
                matchNum = 0;
            } else {
                str = '<ul class="inputcity_ul">' + matchStr + aroundStr + '</ul>';
            }
            cityCtrlZhm.matchedNum = matchNum;
            if (cityCtrlZhm.matchedNum == 1) {
                cityCtrlZhm.matchedKey = matchedKey;
            }
            var Position = cityCtrlZhm.getPosition(obj);
            $('#cityselect').hide();
            $('#cityMatched').hide();
            cityCtrlZhm.setMatchOut(Position, obj, str);
        } else {
            $('#cityselect').show();
            $('#cityMatched').hide();
        }
    },
    cityBlur: function (obj) {
        if(!!$(obj).val()){
            for(var kid in CityData){
                var kk =  cityCtrlZhm.getKey($(obj).val() , CityData[kid]);
                if(kk){
                    cityCtrlZhm.matchedNum = 1;
                    cityCtrlZhm.matchedKey = kid;
                    break;
                }
            }
        }
        if($(obj).val()){
        	return false;
        }
        var name = $(obj).attr('name');
        var InputName = name.replace('InputZhm', '');
        $('#' + InputName).remove();
        if (cityCtrlZhm.matchedNum == 1) {
            $(obj).val(CityData[cityCtrlZhm.matchedKey]['AirFullName']).attr('name', InputName + 'InputZhm')
                .after('<input id="' + InputName + '" name="' + InputName + '" value="' + CityData[cityCtrlZhm.matchedKey]['AirportCode'] + '" type="hidden" />');
        } else if (cityCtrlZhm.matchedNum > 1) {
            $(obj).val('');
        }
    },
    initCity: function (name, cityName, cityCode) {   //初始化城市数据输入框
        $('#' + name).remove();
        if (!cityCode && cityName) {
            cityCode = cityCtrlZhm.getCodeFromName(cityName);
        } else if (cityCode && !cityName) {
            cityName = cityCtrlZhm.getNameFromCode(cityCode);
        }
        if($('input[name="'+name+'InputZhm"]').length > 0){
            $('input[name="'+name+'InputZhm"]').val(cityName);
            if($('input[name="'+name+'"]').length > 0){
                $('input[name="'+name+'"]').val(cityCode);
            }else{
                $('input[name="'+name+'InputZhm"]').after('<input id="' + name + '" name="' + name + '" value="' + cityCode + '" type="hidden" />');
            }
        }else{
            $('input[name="' + name + '"]').val(cityName).attr('name', name + 'InputZhm').data('code', cityCode)
                .after('<input id="' + name + '" name="' + name + '" value="' + cityCode + '" type="hidden" />');
        }
    },
    initCityCtrl: function (ctrl) {      //初始化控件
        //if (!cityCtrlZhm.airPortInfo) {
        cityCtrlZhm.airPortInfo = CityData;
        //}
        if (ctrl.skin) {
            cityCtrlZhm.skin = ctrl.skin;
        }
        if (ctrl.city) {
            for (var i in ctrl.city) {
                cityCtrlZhm.initCity(ctrl.city[i].inputName, ctrl.city[i].cityName, ctrl.city[i].cityCode);
            }
        }
        $('body').on('click', '.chooseCity', function () {
            cityCtrlZhm.selectCity($(this).data('code'), $(this).data('name'));
        });
    }
});
$(document).ready(function(){
    $('.zhmCity').on('keyup' ,function(){
        cityCtrlZhm.cityKeyup(this);
    }).on('click' ,function(){
        cityCtrlZhm.cityClick(this);
    }).on('blur' , function(){
        cityCtrlZhm.cityBlur(this);
    });
    document.onmousedown = function(event){
        event = window.event || event;
        var mouseValeue = event.button;
        if($('#cityselect').length > 0){
            var obj1 = document.getElementById('cityselect');
            var clientX = event.clientX;
            var clientY = event.clientY + ($(document).scrollTop()-0);
            var citylX1 = obj1.offsetLeft;
            var citylY1 = obj1.offsetTop;
            var cityrX1 = obj1.offsetLeft+obj1.clientWidth;
            var cityrY1 = obj1.offsetTop+obj1.clientHeight;
            if(document.all){   //IE
                if(mouseValeue != 0){
                    if(clientX < citylX1 || clientX > cityrX1 || clientY < citylY1 || clientY > cityrY1){
                        $('#cityselect').hide();
                    }
                }
            }else{
                if(mouseValeue == 0 || mouseValeue == 1 || mouseValeue == 2){
                    if(clientX < citylX1 || clientX > cityrX1 || clientY < citylY1 || clientY > cityrY1){
                        $('#cityselect').hide();
                    }
                }
            }
        }
        if($('#cityMatched').length > 0){
            var obj2 = document.getElementById('cityMatched');
            var citylX2 = obj2.offsetLeft;
            var citylY2 = obj2.offsetTop + ($(document).scrollTop()-0);
            var cityrX2 = obj2.offsetLeft+obj2.clientWidth;
            var cityrY2 = obj2.offsetTop+obj2.clientHeight;
            if(document.all){   //IE
                if(mouseValeue != 0){
                    if(clientX < citylX2 || clientX > cityrX2 || clientY < citylY2 || clientY > cityrY2){
                        $('#cityMatched').hide();
                    }
                }
            }else{
                if(mouseValeue == 0 || mouseValeue == 1 || mouseValeue == 2){
                    if(clientX < citylX2 || clientX > cityrX2 || clientY < citylY2 || clientY > cityrY2){
                        $('#cityMatched').hide();
                    }
                }
            }
        }
    };
    //cityCtrlZhm.initCity('CityName' , 'PEK');
    cityCtrlZhm.initCityCtrl({skin:'blue'})
});


